package cc.fs.zhihuapp;

import android.content.Context;
import android.content.SharedPreferences;

import com.orhanobut.hawk.Hawk;
import com.orhanobut.hawk.HawkBuilder;
import com.orhanobut.hawk.LogLevel;

/**
 * Created by fostion on 2015/9/6.
 */
public class AppConfig {

    public static String KEY_THEME = "app_theme";
    public static String KEY_FONTSTYLE = "app_font_style";
    public static String VALUE_LIGHT = "light";
    public static String VALUE_NIGHT = "night";
    public static String VALUE_FONT_SMALL = "small";
    public static String VALUE_FONT_MEDIUM = "medium";
    public static String VALUE_FONT_BIG = "big";
    public static String file = "app_config";

    public static void init(Context context){
         Hawk.init(context)
             .setEncryptionMethod(HawkBuilder.EncryptionMethod.MEDIUM)
                 .setStorage(HawkBuilder.newSharedPrefStorage(context))
                 .setLogLevel(LogLevel.FULL)
                 .build();
    }

    public static void save(String key,String value){
        Hawk.chain().put(key,value).commit();
    }

    public static String get(String key){
        String value = Hawk.get(key);
        return value == null? "":value;
    }

}
